<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link href="style/bootstrap.css" rel="stylesheet">
<script type="text/javascript" src="script/jquery.js"></script>
<link href="style/bootstrap.css" rel="stylesheet">
<script type="text/javascript" src="script/bootstrap-modal.js"></script>

<style type="text/css">
.containe {
	padding-left: 70%;
}

.span8 {
	padding-left: 40%;
}
.alert{
	padding-left: 20%;
	color:red;
}

.pagination {
	padding-left: 65%;
	padding-top: 12%;
}
</style>
</head>

<body>
	<div class="navbar">
		<div class="navbar-inner">
			<div class="container" style="width: auto;">
				<a class="btn btn-navbar" data-target=".nav-collapse"
					data-toggle="collapse"> <span class="icon-bar"></span> <span
					class="icon-bar"></span> <span class="icon-bar"></span> </a> <a
					class="brand" href="#">品竹缘健康生活馆</a>
				<div class="nav-collapse">
					<ul class="nav">
						<li class="active"><a href="#">首页</a>
						</li>
						<li class="active"><a href="#">用户管理</a>
						</li>
					</ul>

					<ul class="nav pull-right">
						<li class="divider-vertical"></li>
						<li><a href="#">角色</a>
						</li>
					</ul>
				</div>
			</div>
		</div>
	</div>
	<div class="containe">
		<ul>

			<li><a class="btn btn-info" href="main.jspx?task=all">所有记录</a>
			
			<a class="btn btn-success" href="add.jspx?task=add">添加新纪录</a>
			
			<a class="btn btn-warning" href="main.jspx?task=search">搜索记录</a>
			
			<a class="btn btn-primary" href="main.jspx?task=expore">导出excel</a>
			</li>

		</ul>
	</div>
	<div class="span8">
		<table class="table">
			<thead>
				<tr>
					<th>时间</th>
					<th>单位</th>
					<th>导游</th>
					<th>客源地</th>
					<th>人数</th>
					<th>销售额</th>
					<th>客单价</th>
					<th></th>
				</tr>
			</thead>

			<tbody>
				<c:if test="${empty page.result},${empty listAll}">
					暂无数据
				</c:if>
				
				
				<c:forEach var="s" items="${listAll}">
					<tr>
						<td>${s.time }</td>
						<td>${s.companyname }</td>
						<td>${s.trname }</td>
						<td>${s.address }</td>
						<td>${s.penum }</td>
						<td>${s.totalmoney }</td>
						<td>${s.unitmoney }</td>

						<td><a href="main.jspx?task=edit&id=${s.id }">编辑</a> <a
							class="delete" rel="main.jspx?task=del&id=${s.id }" href="javascript:void(0)">删除</a>
						</td>
					</tr>
				</c:forEach>
				<c:if test="${empty page.result},${empty listAll}">
					<tr>
						<td colspan="3">暂时没有数据:)</td>
					</tr>
				</c:if>
				<c:forEach var="s" items="${page.result}">
					<tr>
						<td>${s.time }</td>
						<td>${s.companyname }</td>
						<td>${s.trname }</td>
						<td>${s.address }</td>
						<td>${s.penum }</td>
						<td>${s.totalmoney }</td>
						<td>${s.unitmoney }</td>

						<td><a href="main.jspx?task=edit&id=${s.id }">编辑</a> 
						<a
							class="delete" rel="main.jspx?task=del&id=${s.id }"
							href="javascript:void(0)">删除</a>
						</td>
					</tr>
				</c:forEach>
			</tbody>
		</table>
		<c:if test="${empty listSum},${empty listAll}">
			暂时无数据！
		</c:if>
		<div class="alert">
				总记录数:${sum} 条
				 &nbsp &nbsp
				总销售额：${sumtotal}元 
				&nbsp &nbsp  
				总人数：${sumpeople}  
				&nbsp 
				平均客单价：${unitmoney}元
		</div>
	</div>
	<div class="pagination">
		<ul>
			<c:choose>
				<c:when test="${page.pageNum==1 }">
					<li class="prev disable"><a>首页</a>
					</li>
				</c:when>
				<c:otherwise>
					<li class="prev"><a href="main.jspx?task=main&p=1">首页</a>
					</li>
				</c:otherwise>
			</c:choose>
			<c:choose>
				<c:when test="${page.pageNum==1 }">
					<li><a>上一页</a>
					</li>
				</c:when>
				<c:otherwise>
					<li><a href="main.jspx?task=main&p=${page.pageNum-1}">上一页</a>
					</li>
				</c:otherwise>
			</c:choose>


			<c:choose>
				<c:when test="${page.totalPages==page.pageNum }">
					<li><a>下一页</a>
					</li>
				</c:when>
				<c:otherwise>
					<li><a href="main.jspx?task=main&p=${page.pageNum+1}">下一页</a>
					</li>
				</c:otherwise>
			</c:choose>
			<c:choose>
				<c:when test="${page.totalPages==page.pageNum }">
					<li class="next disable"><a>尾页</a>
					</li>
				</c:when>
				<c:otherwise>
					<li class="next"><a
						href="main.jspx?task=main&p=${page.totalPages}">尾页</a>
					</li>
				</c:otherwise>
			</c:choose>

		</ul>
	</div>
	
	
	
	
	
	<div id="hi" class="modal hide fade" style="background-color: #888; border: none; padding: 120px; display: none;" >
			<div class="modal-header">
				<a class="close" href="">x</a>
				<h3>确定删除吗？</h3>
			</div>
			
			<div class="modal-footer">
				<a id="mydelet" class="btn primary" href="javascript:void(0)">确定</a>
				<a class="btn secondary" href="">取消</a>
			</div>
	</div>
<script type="text/javascript">
		$(function(){
			var uurl;
			$(".delete").click(function(){
				
				uurl=$(this).attr("rel");
				$("#hi").modal("show");
				
				
			});
			$("#mydelet").click(function(){
				window.location.href=uurl;
			})	;
			
			
		});
	</script>
</body>
</html>
